package com.cskaoyan.service.wx.lxc;

import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.po.MarketBrand;
import com.cskaoyan.bean.po.MarketBrandExample;
import com.cskaoyan.mapper.MarketBrandMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxBrandServicelmpl implements WxBrandService {

    @Autowired
    MarketBrandMapper marketBrandMapper;

    @Override
    public CommonData<MarketBrand> queryBrandList(BasePageInfo basePageInfo) {
        PageHelper.startPage(basePageInfo.getPage(),basePageInfo.getLimit());
        List<MarketBrand> marketBrands = marketBrandMapper.selectByExample(new MarketBrandExample());
        PageInfo<MarketBrand> marketBrandPageInfo = new PageInfo<>(marketBrands);
        return CommonData.data(marketBrandPageInfo);
    }

    @Override
    public MarketBrand detailBrand(Integer id) {
        MarketBrand marketBrand = marketBrandMapper.selectByPrimaryKey(id);
        return marketBrand;
    }
}
